var str = "nanfeng"; // string类型
// 字面量类型
var str1 = "nanfeng"; //nanfeng类型
var age = 18;
// 游戏的方向 上下左右
function changeDirection(direction) {
    console.log(direction);
}
changeDirection("down");
// 定义枚举 有值默认为0,递增
var Direction;
(function (Direction) {
    Direction[Direction["up"] = 0] = "up";
    Direction[Direction["down"] = 1] = "down";
    Direction[Direction["left"] = 2] = "left";
    Direction[Direction["right"] = 3] = "right";
})(Direction || (Direction = {}));
function changedDirection(direction) {
    console.log(direction);
}
changedDirection(Direction.right); // 3  返回值是索引
// 设置枚举值
var test;
(function (test) {
    test[test["up"] = 10] = "up";
    test[test["down"] = 11] = "down";
    test[test["left"] = 12] = "left";
    test[test["right"] = 13] = "right";
})(test || (test = {}));
var test1;
(function (test1) {
    test1[test1["up"] = 13] = "up";
    test1[test1["down"] = 14] = "down";
    test1[test1["left"] = 15] = "left";
    test1[test1["right"] = 16] = "right";
})(test1 || (test1 = {}));
var test2;
(function (test2) {
    test2[test2["up"] = 2] = "up";
    test2[test2["down"] = 4] = "down";
    test2[test2["left"] = 6] = "left";
    test2[test2["right"] = 8] = "right";
})(test2 || (test2 = {}));
// 字符串枚举
var Direction1;
(function (Direction1) {
    Direction1["up"] = "up";
    Direction1["down"] = "down";
    Direction1["left"] = "left";
    Direction1["right"] = "right";
})(Direction1 || (Direction1 = {}));
function changedDirection1(direction) {
    console.log(direction);
}
changedDirection1(Direction1.right); // "right"  返回值是right
